//
//  SearchListCell.m
//  LiveStar
//
//  Created by 漪珊 on 2017/4/17.
//  Copyright © 2017年 apple. All rights reserved.
//

#import "SearchListCell.h"
#import "SearchlistModel.h"

@implementation SearchListCell

- (void)awakeFromNib {
    [super awakeFromNib];
    kButtonRadius(self.focusBtn, self.focusBtn.height/2);
    kImageViewRadius(self.starImgView, self.starImgView.height/2);
}
- (void)setSearchModel:(SearchlistModel *)searchModel {
    _searchModel = searchModel;
    [self.starImgView sd_setImageWithURL:[NSURL URLWithString:searchModel.u_avatar] placeholderImage:kPlACE_ICON];
    self.starName.text = searchModel.s_name;
    self.focusNum.text = [NSString stringWithFormat:@"%@人关注",KString(searchModel.s_booked)];
    if ([searchModel.booked intValue] == 10) {
        [self.focusBtn setTitle:@"已关注" forState:UIControlStateNormal];
        [self.focusBtn setTitleColor:[UIColor colorWithHexString:@"04DD98"] forState:UIControlStateNormal];
        self.focusBtn.backgroundColor = [UIColor whiteColor];
    } else {
        [self.focusBtn setTitle:@"+ 关注" forState:UIControlStateNormal];
        [self.focusBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        self.focusBtn.backgroundColor = [UIColor colorWithHexString:@"04DD98"];
    }
}
//关注
- (IBAction)focusAction:(id)sender {
    if (self.focusAction) {
        self.focusAction();
    }
}

@end
